home *** CD-ROM | disk | FTP | other *** search
/ Utilities Professional 1-1500 / Utilities Professional 1-1500 (1994)(WPD)[!].iso / 12511500 / var1308.dms / var1308.adf / DNET2_10.LHA / DNet / Amiga / Sourcen.lha / doshand / dos.h < prev    next >
C/C++ Source or Header  |  1993-01-14  |  4KB  |  208 lines

  1.  
  2. /*
  3.  *  DOS.H
  4.  */
  5.  
  6. #include <stdio.h>
  7. #include <local/typedefs.h>
  8. #include <local/xmisc.h>
  9. #include "/server/servers.h"
  10. #include "/dnet/channel.h"
  11. #include "/lib/dnetlib.h"
  12.  
  13. #ifdef LATTICE
  14. #include <stdlib.h>
  15. #include <string.h>
  16. #endif
  17.  
  18. #ifdef NOTDEF
  19. #include "exec/types.h"
  20. #include "exec/memory.h"
  21. #include "libraries/dos.h"
  22. #include "libraries/dosextens.h"
  23. #include "libraries/filehandler.h"
  24. #endif NOTDEF
  25.  
  26. /*
  27.  *  ACTIONS which do not exist in dosextens.h but which indeed exist on
  28.  *  the Amiga.
  29.  */
  30.  
  31. #define ACTION_OPENRW        1004
  32. #define ACTION_OPENOLD        1005
  33. #define ACTION_OPENNEW        1006
  34. #define ACTION_CLOSE        1007
  35. #define ACTION_SEEK        1008
  36. #define ACTION_RAWMODE        994
  37. #define ACTION_MORECACHE    18
  38. #define ACTION_FLUSH        27
  39.  
  40. #define DOS_FALSE   0
  41. #define DOS_TRUE    -1
  42.  
  43. typedef struct DosPacket    PACKET;
  44. typedef struct DeviceNode    DEVNODE;
  45. typedef struct DeviceList    DEVLIST;
  46. typedef struct DosInfo        DOSINFO;
  47. typedef struct RootNode     ROOTNODE;
  48. typedef struct FileHandle    FH;
  49. typedef struct DateStamp    STAMP;
  50. typedef struct InfoData     INFODATA;
  51. typedef struct DosLibrary    DOSLIB;
  52.  
  53. #define FILE_DIR    1
  54. #define FILE_FILE   -1
  55.  
  56. #define LOCKLINK    struct _LOCKLINK
  57. #define HANDLE        struct _HANDLE
  58.  
  59. /*
  60.  *  We use this structure to link locks together in a list for internal
  61.  *  usage.  I could have use the link field in the lock structure as a
  62.  *  real linked list, but didn't want to have to sequentially search the
  63.  *  list to remove a node.
  64.  *
  65.  *  NOTE:   You CANNOT simply extend the FileLock (LOCK) structure.  Some
  66.  *  programs assume it is sizeof(LOCK) big and break.  I found this out the
  67.  *  hard way.
  68.  */
  69.  
  70. LOCKLINK {
  71.     NODE    Node;
  72.     LOCK    *Lock;
  73. };
  74.  
  75. /*
  76.  *  OPERATION STRUCTURES
  77.  */
  78.  
  79. typedef struct {
  80.     long    DirHandle;        /*  relative to directory (0=root)  */
  81.     uword   Modes;        /*  open modes                */
  82. } OpOpen;
  83.  
  84. typedef struct {
  85.     long    Handle;
  86.     ulong   Prot;
  87.     long    Type;
  88.     long    Size;
  89.     STAMP   Date;        /*  date stamp    */
  90. } RtOpen;
  91.  
  92.  
  93. typedef struct {
  94.     long    Handle;        /*  file handle to read from        */
  95.     long    Bytes;        /*  # of bytes to read            */
  96. } OpRead;
  97.  
  98. typedef struct {
  99.     long    Bytes;        /*  < 0 == error            */
  100. } RtRead;
  101.  
  102. typedef struct {
  103.     long    Handle;        /*  file handle to read from        */
  104.     long    Bytes;        /*  # of bytes to read            */
  105. } OpWrite;
  106.  
  107. typedef struct {
  108.     long    Bytes;        /*  < 0 == error            */
  109. } RtWrite;
  110.  
  111. typedef struct {
  112.     long    Handle;
  113. } OpClose;
  114.  
  115. typedef struct {
  116.     long    Handle;
  117.     long    Offset;
  118.     long    How;
  119. } OpSeek;
  120.  
  121. typedef struct {
  122.     long    OldOffset;
  123.     long    NewOffset;        /*    -1 = error  */
  124. } RtSeek;
  125.  
  126. typedef struct {
  127.     long    Handle;
  128. } OpParent;
  129.  
  130. typedef RtOpen    RtParent;
  131.  
  132. typedef struct {
  133.     long    DirHandle;
  134. } OpDelete;
  135.  
  136. typedef struct {
  137.     long    Error;
  138. } RtDelete;
  139.  
  140. typedef OpDelete OpCreateDir;
  141. typedef RtParent RtCreateDir;
  142.  
  143. typedef struct {
  144.     long    Handle;
  145. } OpDup;
  146.  
  147. typedef RtOpen    RtDup;
  148.  
  149. typedef struct {
  150.     long    Handle;        /*    oops, actually a directory handle   */
  151.     long    Index;
  152. } OpNextDir;
  153.  
  154. typedef RtOpen    RtNextDir;
  155.  
  156. typedef struct {
  157.     long    DirHandle1;
  158.     long    DirHandle2;
  159. } OpRename;
  160.  
  161. typedef struct {
  162.     long    Error;
  163. } RtRename;
  164.  
  165. /*
  166.  *  Filehandle structure associated with an open file handle
  167.  */
  168.  
  169.  
  170. #define MAGIC    0x1AFB439C
  171.  
  172. HANDLE {
  173.     NODE    Node;    /*  link node        */
  174.     long    Magic;
  175.     LOCK    *Lock;    /*  lock if any     */
  176.     long    Handle;    /*  remote handle    */
  177.     short   Type;    /*  file type        */
  178.     ulong   Prot;    /*  protection bits    */
  179.     ulong   Size;    /*  file size        */
  180.     STAMP   Date;    /*  date stamp        */
  181.     char    *Name;    /*  file name        */
  182. };
  183.  
  184. /*
  185.  *  (void *)  in Aztec C means 'pointer to anything'.  I use it
  186.  *  extensively.
  187.  */
  188.  
  189. /* REMOVED
  190.  
  191. extern void returnpacket();
  192. extern void *GetLockForHandle();
  193. extern HANDLE *GetHandleForLock();
  194. extern void *AllocMem(), *RemHead(), *GetMsg();
  195. extern void *FindTask(), *Open(), *OpenLibrary();
  196.  
  197. extern void  *dosalloc(), *GetSucc(), *GetHead();
  198. extern LOCK  *ramlock();
  199. extern char  *bstos();
  200. extern char  *skipdevice();
  201. extern HANDLE    *getlockfile();
  202.  
  203. extern char *getpathelement();
  204. extern char *typetostr();
  205.  
  206.   */
  207.  
  208.